
<?php	
	
	class partner extends database
	{
		var $connection = '';	

		function partner()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from tblpartners";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();			
			$sql = "SELECT * from tblpartners ";			
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
        
        function AddPartner($Title, $SourceCode, $Description, $HitNumber, $AddToCart, $Ordered, $DateSubmit, $ActiveYN)
		{
            $DateSubmit=date('Y-m-d H:i:s', time());
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Insert into tblpartners(`Title`, `SourceCode`, `Description`, `HitNumber`
            , `AddToCart`, `Ordered`, `DateSubmit`, `ActiveYN`) 
            values('".$Title."', '".$SourceCode."', '".$Description."', '".$HitNumber."', '".$AddToCart."'
            , '".$Ordered."', '".$DateSubmit."', '".$ActiveYN."')";
            //echo $sql;
			$this->setQuery($sql);
			$this->query();
		}
		
		function UpdatePartner($Title, $SourceCode, $Description, $HitNumber, $AddToCart, $Ordered, $ActiveYN, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update tblpartners set `Title` =  '".$Title."', 
            `SourceCode` = '".$SourceCode."', `Description` = '".$Description."', 
            `HitNumber` = '".$HitNumber."',`AddToCart` = '".$AddToCart."',`Ordered` = '".$Ordered."', 
            `ActiveYN` = '".$ActiveYN."'";
			$sql .= " where PartnerID=".$id;	
            //echo $sql;		
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOnePartner($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from tblpartners where PartnerID=".$id."";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeletePartner($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Delete from tblpartners ";
			$sql .= " where PartnerID=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
	
		
	}
?>